/*! ******************************************************************************
 *
 * Created on 2022年3月29日
 *
 * Copyright(c) YuZhou Big Data Laboratory CO.,Ltd, 2022.  All rights reserved.
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************/
package org.yzbdl.lanius.ui.spoon.middle.ext.progress;

import cn.hutool.core.lang.func.Func;
import lombok.Getter;
import lombok.Setter;

/**
 * @author hs@yzbdl.ac.cn
 *
 */
@Getter
@Setter
public class Progress {

	/**
	 * 名称
	 */
	private String name;

	/**
	 * 描述信息, 显示在进度条上面
	 */
	private String description;

	/**
	 * 进度最大值
	 */
	private int maximum = 100;

	/**
	 * 当前进度值
	 */
	private int selection = 0;

	/**
	 * 是否自动移除
	 */
	private boolean autoRemove;

	/**
	 * 取消回调函数
	 */
	private Func<Object, Object> cancelFunc;

	/**
	 * 取消回调函数参数
	 */
	private Object cancelParam;

	/**
	 * 执行取消操作
	 * 
	 * @throws Exception
	 */
	public void execCancel() throws Exception {
		if (cancelFunc != null) {
			cancelFunc.call(cancelParam);
		}
	}

}
